<!--
 * @Descripttion: 
 * @Author: YuZhenJing
 * @Date: 2020-02-10 17:44:29
 * @LastEditors: YuZhenJing
 * @LastEditTime: 2020-03-27 17:45:36
 -->
<template>
  <div class="axios">
    <el-button type="success" @click="auth">auth</el-button>
    <el-button type="success" @click="get">Get</el-button>
    <el-button type="success" @click="redirectUrl">redirectUrl</el-button>
    <el-button type="success" @click="points">points</el-button>
    <el-button type="success" @click="colors">colors</el-button>
    <el-button type="success" @click="objTools">objTools1</el-button>
  </div>
</template>

<script>
import AsmClient from "../../packages";
export default {
  name: "Axios",
  methods: {
    objTools() {
      console.log(AsmClient.ObjTools);
    },
    colors() {
      AsmClient.Colors.setColors(AsmClient.initParam.htmlParam.defaultTheme);
      console.log(AsmClient.Colors, AsmClient.initParam.htmlParam.defaultTheme);
    },
    points() {
      let userInfo = {
        accountType: "sys_manager",
        enabled: true,
        personName: "超级管理员",
        userEmail: "super@qq.com",
        userGender: "male",
        userId: "super",
        userPhone: "13888888888",
        username: "super",
        userPoints: [{ funPointsCode: "AAAA" }]
      };
      this.$auth.userInfo.set(userInfo);

      console.log("this方式", this.$points.permission("AAAA"));
      console.log("import AsmClient方式", AsmClient.Points.permission("AAAA"));
    },
    auth() {
      this.$auth.token.set("123456789");
      this.$auth.hostUrl.set("http://localhost:8080");
      console.log("this方式", this.$auth.hostUrl.get());
      console.log("import方式", AsmClient.Auth.hostUrl.get());
    },
    get() {
      const getResult = this.$html.get("plugins/getTest");
      getResult
        .then(data => {
          console.log(data);
        })
        .catch(error => {
          console.log("error:axios/get", error);
        });
    },
    redirectUrl() {
      const getResult = this.$html.get("plugins/redirectUrl");
      getResult
        .then(data => {
          console.log(data);
        })
        .catch(error => {
          console.log("error:axios/redirectUrl", error);
        });
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped></style>
